package cn.uexpo.lhz.biz;

import java.util.List;

import com.alibaba.fastjson.JSONObject;

import cn.uexpo.lhz.common.oldBase.BOException;
import cn.uexpo.lhz.common.oldBase.BaseBiz;
import cn.uexpo.lhz.domain.Dictionary;
import cn.uexpo.lhz.domain.DictionaryExample;
import cn.uexpo.lhz.domain.DictionaryItem;

public interface DictionaryBiz  extends BaseBiz<Dictionary,DictionaryExample> {

    /**
     * 根据字典code删除该字典记录和对应的条目记录
     * @param code
     * @return
     * @throws BOException
     */
    Integer deleteDictionaryByDictCode(String dicCode) throws BOException;
    
//    /**
//     * 根据字典dicCode查找 字典记录
//     * @param dicCode
//     * @return
//     * @throws BOException
//     */
//    Dictionary selectDictByDictCode(String dicCode) throws BOException;
    
    
    
    
    /**
     * 根据字典dicCode查找所有条目
     * @param dicCode
     * @return
     * @throws BOException
     */
    List<DictionaryItem> selectDictItmesByDictCode(String dictCode) throws BOException;
    
    /**
     * 根据dicCode itemCode查找该条目
     * @param dicCode
     * @param itemCode
     * @return
     * @throws BOException
     */
    DictionaryItem selectDictItmeByDicCodeItemCode(String dictCode, String itemCode) throws BOException;
    
    /**
     * 根据字典编码，条目编码查找条目值
     * @param dictCode
     * @param itemCode
     * @return
     * @throws BOException
     */
    String selectValueBy(String dictCode, String itemCode) throws BOException;
    /**
     * 根据字典编码，条目编码查找条目名称
     * @param dictCode
     * @param itemCode
     * @return
     * @throws BOException
     */
    String selectNameBy(String dictCode, String itemCode) throws BOException;
    /**
     * 根据字典编码获取json格式的list   例子:[{"code":"huoche","name":"货车"}, {"code":"mianbaoche","name":"面包车"}, {"code":"kache","name":"卡车"}, {"code":"chzuche","name":"出租车"}, {"code":"baoma","name":"宝马"}, {"code":"benchi","name":"奔驰"}]
     * @param dictCode
     * @return
     * @throws BOException
     */
    List<JSONObject> selectJsonByDictCode(String dictCode) throws BOException;
    /**
     * 根据字典编码获取json格式的list,key为自定义     例子: [{"name":"货车","id":"huoche"}, {"name":"面包车","id":"mianbaoche"}, {"name":"卡车","id":"kache"}, {"name":"出租车","id":"chzuche"}, {"name":"宝马","id":"baoma"}, {"name":"奔驰","id":"benchi"}]
     * @param dictCode
     * @param keyCode
     * @param nameCode
     * @return
     * @throws BOException
     */
    List<JSONObject> selectJsonByDictCode(String dictCode, String keyCode, String nameCode) throws BOException;
    
    //有"请选择"的下来框
    List<JSONObject> selectJsonInitFalg(String dictCode, String id, String text) throws BOException;
    
    /**
     * 查看字典类型
     * @return
     * @throws BOException
     */
    List<String> selectDistinctTypes() throws BOException;
	/**
	 * 根据类型查看字典
	 * @param type
	 * @return
	 * @throws BOException
	 */
    List<Dictionary> selectByType(String type) throws BOException;
    
}